package com.jcl.cloud.services.unicrawler.task;


import com.jcl.cloud.common.service.util.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
public class GetAccountTaskHandler {


    @Autowired
    CrawlerTaskHandler crawlerTaskHandler;


    @Scheduled(
            fixedRate = 24*60*60*1000L
    )
    public void getAccount(){


        try {
            String url = "http://www.jucailin.com/api/crawler/corp/account?source=";
            String [] sourceArr = {"zhaopin","51job"};


            for(String srcCode : sourceArr){
                try {
                    String ret = HttpClientUtil.doGet(url+srcCode);
                    this.crawlerTaskHandler.addTask(ret);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }


}
